package com.xxhui.bezierdemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.RadioButton;
import android.widget.RadioGroup;

import com.xxhui.bezierdemo.view.ThirdOrder;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = "BezierDemo";
    private RadioGroup group ;
    private RadioButton control1 ;
    private RadioButton control2 ;
    private ThirdOrder thirdOrder;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.third_order);
        group = (RadioGroup) findViewById(R.id.switch_control);
        control1 = (RadioButton) findViewById(R.id.control1);
        control2 = (RadioButton) findViewById(R.id.control2);
        thirdOrder = (ThirdOrder) findViewById(R.id.third_order);

        group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, int i) {
                switch (i){
                    case R.id.control1:
                        thirdOrder.setSwitchControl(true);
                        Log.i(TAG, "onClick: control1 ");
                        break;
                    case R.id.control2:
                        thirdOrder.setSwitchControl(false);
                        Log.i(TAG, "onClick: control2 ");
                        break;
                    default:
                        Log.i(TAG, "onClick: default");
                        break;
                }
            }
        });
    }
}
